#include <stdio.h>
#include <stdlib.h>

typedef struct node
{
    int data;
    struct node* next;
}LNode;
void SlistPushback(LNode**phead,int x)
{
    LNode* newnode;
    newnode=(LNode*)malloc(sizeof(LNode));
    newnode->data=x;
    newnode->next=NULL;
    if(*phead==NULL)
    {
        *phead=newnode;
    }
    else
    {
        LNode* tail=*phead;
        while(tail->next!=NULL)
        {
            tail=tail->next;
        }
        tail->next=newnode;
    }
}
int main()
{
    LNode* plist;
    plist=(LNode*)malloc(sizeof(LNode));
    plist=NULL;
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        SlistPushback(&plist,i);
    }
    LNode* cur=plist;
    while(cur!=NULL)
    {
        printf("%d ",cur->data);
        cur=cur->next;
    }
    return 0;
}
